package com.jvup.gameshow.model.entity;

import java.util.ArrayList;
import java.util.List;

public class ImageFloder {
	/**
		 * 图片的文件夹路径
		 */
		private String dir;

		/**
		 * 第一张图片的路径
		 */
		private String firstImagePath;
		/**
		 * 文件夹的名称
		 */
		private String name;

		public final List<ImageItem> images = new ArrayList<>();


		public void setDir(String dir) {
			this.dir = dir;
			int lastIndexOf = this.dir.lastIndexOf("/");
			if (lastIndexOf + 1 <= this.dir.length()) {
				this.name = this.dir.substring(lastIndexOf + 1);
			} else {
				this.name = this.dir.substring(lastIndexOf);
			}
		}
		public String getFirstImagePath() {
			if(images.isEmpty())
				return "";
			if(firstImagePath==null)
				firstImagePath = images.get(0).path;
			return firstImagePath;
		}

		public void setFirstImagePath(String firstImagePath) {
			this.firstImagePath = firstImagePath;
		}

		public String getName() {
			return name;
		}
	}